package com.dhcc.DRGsHosp.facade.impl;

import com.dhcc.DRGsHosp.application.FeeAnalysisDepApplication;
import com.dhcc.DRGsHosp.core.domain.IndexCal;
import com.dhcc.DRGsHosp.facade.DrgsIndexCalFacade;
import com.dhcc.DRGsHosp.facade.FeeAnalysisDepFacade;
import com.dhcc.DRGsHosp.infra.util.DrgsIndex;
import org.springframework.beans.factory.annotation.Autowired;

import javax.inject.Named;
import java.util.List;
import java.util.Map;

/**
 * 
 * @author Administrator
 *
 */
@Named
public class FeeAnalysisDepFacadeImpl implements FeeAnalysisDepFacade  {

	@Autowired
	private  FeeAnalysisDepApplication  feeAnalysisDepApplication;
	@Autowired
	private DrgsIndexCalFacade drgsIndexCalFacade;
	/**
	 * 科室费用变化趋势
	 */
	@Override
	public List<Map<String, Object>> getDepFeeVareTrend(String dateFrom, String dateTo, String depCode,String hospCode,String pType, String groupCode) {
		dateFrom=DrgsIndex.formateDateFrom(dateFrom);
		dateTo=DrgsIndex.formateDateTo(dateTo);
		List<Map<String, Object>> list=feeAnalysisDepApplication.getDepFeeVareTrend(dateFrom, dateTo, depCode ,hospCode, pType,groupCode);
		return list;
	}
	/**
	 *  不同特征区间内病例分布情况
	 */
	@Override
	public List<Map<String, Object>> getDepOverFeeCaseShow(String dateFrom, String dateTo, String depCode,
			String hospCode, String sliderValBench, String compareObj
			, String compareType,String pType, String groupCode) {
		dateFrom=DrgsIndex.formateDateFrom(dateFrom);
		dateTo=DrgsIndex.formateDateTo(dateTo);
		String groupScheme=drgsIndexCalFacade.getGroupScheme();
		String stdId=drgsIndexCalFacade.getStdID(dateFrom,dateTo);   //获取标杆定位id
		List<Map<String, Object>> list=feeAnalysisDepApplication.getDepOverFeeCaseShow(dateFrom,dateTo,
					depCode,hospCode,sliderValBench,compareObj,compareType,groupScheme,stdId,pType, groupCode);
		return list;
	}
	/**
	 * 排除特异病例后次均费用.费用构成及其对比情况表
	 */
	@Override
	public List<Map<String, Object>> getDepFeeOutAbnormalTable(String dateFrom, String dateTo, String depCode,
			String hospCode, String sliderValBench, String compareObj, String compareType
			,String compareAbnormal,String pType, String groupCode) {
		dateFrom=DrgsIndex.formateDateFrom(dateFrom);
		dateTo=DrgsIndex.formateDateTo(dateTo);
		String groupScheme=drgsIndexCalFacade.getGroupScheme();
		String stdId=drgsIndexCalFacade.getStdID(dateFrom,dateTo);   //获取标杆定位id
		List<Map<String, Object>> list=feeAnalysisDepApplication.getDepFeeOutAbnormalTable(dateFrom,dateTo,
				depCode,hospCode,sliderValBench,compareObj,compareType,groupScheme,stdId, compareAbnormal,pType,groupCode);
		return list;
	}
	/**
	 * 排除特异病例后次均费用.费用构成及其对比情况表(主诊组维度)
	 */
	@Override
	public List<Map<String, Object>> getDepFeeOutAbnormalZZZ(String dateFrom, String dateTo, String depCode,
			String hospCode, String sliderValBench, String compareTip, String compareObj, String compareType,
			String compareAbnormal,String pType) {
		dateFrom=DrgsIndex.formateDateFrom(dateFrom);
		dateTo=DrgsIndex.formateDateTo(dateTo);
		String groupScheme=drgsIndexCalFacade.getGroupScheme();
		String stdId=drgsIndexCalFacade.getStdID(dateFrom,dateTo);   //获取标杆定位id
		List<Map<String, Object>> list=feeAnalysisDepApplication.getDepFeeOutAbnormalZZZ(dateFrom,dateTo,
				depCode,hospCode,sliderValBench,compareTip,compareObj,compareType,groupScheme,stdId, compareAbnormal,pType);
		return list;
	}
	/**
	 * 科室费用分析病例区间分布的病例数点击下的病例明细页面
	 */
	@Override
	public List<Map<String, Object>> loadFeeAnalysisCaseTable(IndexCal index) {
	    String dateFrom = index.getDateFrom();
	    String dateTo = index.getDateTo();
		index.setDateFrom(DrgsIndex.formateDateFrom(dateFrom));
		index.setDateTo(DrgsIndex.formateDateTo(dateTo));
		index.setGroupType(drgsIndexCalFacade.getGroupScheme());
		index.setStdId(drgsIndexCalFacade.getStdID(dateFrom,dateTo));   //获取标杆定位id
		List<Map<String, Object>> list=feeAnalysisDepApplication.loadFeeAnalysisCaseTable(index);
		return list;
	}

	/**
	 *  不同特征区间内病例分布情况
	 */
	@Override
	public List<Map<String, Object>> getDRGOverFeeCaseShow(IndexCal indexCal) {
		String groupScheme=drgsIndexCalFacade.getGroupScheme();
		String stdId=drgsIndexCalFacade.getStdID(indexCal.getDateFrom(),indexCal.getDateTo());//获取标杆定位id
        indexCal.setDateFrom(DrgsIndex.formateDateFrom(indexCal.getDateFrom()));
        indexCal.setDateTo(DrgsIndex.formateDateTo(indexCal.getDateTo()));
		indexCal.setStdId(stdId);
		indexCal.setGroupType(groupScheme);
		List<Map<String, Object>> list=feeAnalysisDepApplication.getDRGOverFeeCaseShow(indexCal);
		return list;
	}
	/**
	 *数据库现有的绩效值的指标获取
	 */
	@Override
	public List<Map<String, Object>> getManagerQuotaCode(String dateTo, String pType) {
		List<Map<String, Object>> list=feeAnalysisDepApplication.getManagerQuotaCode(dateTo, pType);
		return list;
	}
	/**
	 * DRG病组次均费用、费用构成及其对比情况表数据获取
	 */
	@Override
	public List<Map<String, Object>> getDrgCompareData(IndexCal indexCal) {
		String groupScheme=drgsIndexCalFacade.getGroupScheme();
		String stdId=drgsIndexCalFacade.getStdID(indexCal.getDateFrom(),indexCal.getDateTo());//获取标杆定位id
        indexCal.setDateFrom(DrgsIndex.formateDateFrom(indexCal.getDateFrom()));
        indexCal.setDateTo(DrgsIndex.formateDateTo(indexCal.getDateTo()));
		indexCal.setStdId(stdId);
		indexCal.setGroupType(groupScheme);
		List<Map<String, Object>> list=feeAnalysisDepApplication.getDrgCompareData(indexCal);
		return list;
	}
	/**
	 * 病组展开的 次均费用、费用构成及其对比情况表
	 */
	@Override
	public List<Map<String, Object>> getDrgFeeCompareTable(IndexCal indexCal) {
		String groupScheme=drgsIndexCalFacade.getGroupScheme();
		String stdId=drgsIndexCalFacade.getStdID(indexCal.getDateFrom(),indexCal.getDateTo());//获取标杆定位id
        indexCal.setDateFrom(DrgsIndex.formateDateFrom(indexCal.getDateFrom()));
        indexCal.setDateTo(DrgsIndex.formateDateTo(indexCal.getDateTo()));
		indexCal.setStdId(stdId);
		indexCal.setGroupType(groupScheme);
		List<Map<String, Object>> list=feeAnalysisDepApplication.getDrgFeeCompareTable(indexCal);
		return list;
	}

}

